﻿using Custom.Infrastructure;
using Custom.Model.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Custom.Service.Repository
{
    public class SaleDetailRepository : DbContext<SaleDetail>
    {
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="details"></param>
        public void UpdateSave(List<SaleDetail> details)
        {
            long saleid = details.FirstOrDefault().saleid;

            Db.Ado.BeginTran();

            try
            {
                Delete(d => d.saleid == saleid);
                Insert(details);
                Db.Ado.CommitTran();
            }
            catch
            {
                Db.Ado.RollbackTran();
            }
        }
    }
}
